package com.lipaluma.field.adaptor;

import java.lang.reflect.Field;

import com.lipaluma.context.Context;
import com.lipaluma.xml.adaptor.XmlAdaptor;

/**
 * Adaptor permits adapt, or transform the extracted value from the entry file before parsing
 * 
 * @author Mario
 */
public interface Adaptor {

	/**
	 * Init the adaptor by the field and annotations
	 * @param context TODO
	 * @param field
	 * @return true if the initialisation pass
	 */
	boolean init(Context context, Field field);

	/**
	 * Init the adaptor by the xml file configuration
	 * @param context TODO
	 * @param field the field
	 * @param element xml of the column element 
	 * @return true if the initialisation pass
	 */
	boolean init(Context context, Field field, XmlAdaptor xmlAdaptor);

	/**
	 * adapt the value extracted by making transformations to be parsed correctly
	 * @param value the value extracted
	 * @return the value adapted
	 */
	String adapt(String value);

}
